package cn.heyige.backend.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@Schema(description = "卦象信息响应")
public class HexagramInfoResponse {
    
    @Schema(description = "总数", example = "64")
    private Integer total;
    
    @Schema(description = "卦象列表")
    private List<HexagramInfo> hexagrams;
    
    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @Schema(description = "卦象信息")
    public static class HexagramInfo {
        @Schema(description = "卦象ID", example = "1")
        private Long id;
        
        @Schema(description = "卦象名称", example = "乾为天")
        private String name;
        
        @Schema(description = "卦象编码", example = "QIAN_WEI_TIAN")
        private String code;
        
        @Schema(description = "上卦")
        private TrigramInfo upperTrigram;
        
        @Schema(description = "下卦")
        private TrigramInfo lowerTrigram;
        
        @Schema(description = "卦辞", example = "天行健，君子以自强不息")
        private String hexagramText;
        
        @Schema(description = "卦象描述")
        private String description;
        
        @Schema(description = "卦象类别", example = "MAJOR")
        private String category;
        
        @Schema(description = "序号", example = "1")
        private Integer sequence;
    }
    
    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    @Schema(description = "三元组信息")
    public static class TrigramInfo {
        @Schema(description = "三元组名称", example = "乾")
        private String name;
        
        @Schema(description = "符号", example = "☰")
        private String symbol;
        
        @Schema(description = "属性", example = "天")
        private String nature;
        
        @Schema(description = "五行", example = "金")
        private String element;
        
        @Schema(description = "特性", example = "刚健")
        private String attribute;
        
        @Schema(description = "意义")
        private String meaning;
    }
}